package com.java.basis.thread;

public class TestThreadLocal {
    static ThreadLocal tl1 = new ThreadLocal();
    static ThreadLocal tl2 = new ThreadLocal();

    public static void main(String[] args) {
        tl1.set("123");
        tl2.set("456");
        Thread t1 = new Thread(() ->{
            System.out.println("t1 = " + tl1.get());//123
            System.out.println("t2 = " + tl2.get());//456
        });
        t1.start();
        System.out.println("main = " + tl1.get());//null
        System.out.println("main = " + tl2.get());//null

    }
}
